package com.bc.bcbuyerapihttp.controller;

import com.bc.commoncore.util.CookieUtils;
import com.bc.commonentity.common.JsonResult;
import io.swagger.annotations.ApiOperation;
import org.apache.http.HttpResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("alert")
public class AlertController {
    private static final Logger LOGGER = LoggerFactory.getLogger(AlertController.class);

    @ApiOperation(value = "心跳action")
    @RequestMapping(value = "heart", method = RequestMethod.GET)
    public JsonResult heart() {
        return JsonResult.get("success");
    }

    @ApiOperation(value = "测试方法")
    @RequestMapping(value = "test", method = RequestMethod.GET)
    public JsonResult test(HttpServletRequest request, HttpServletResponse response) {
        CookieUtils.setCookie(request, response, "local", "en", 36000);
        return new JsonResult();
    }
}
